#
# Cookbook Name:: liberty
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#


cuser = node[:chef][:user]
cgroup = node[:chef][:group]


include_recipe "java7::install"

bash "Download liberty" do
    user cuser
    cwd "/tmp/"
    creates "/tmp/downloadliberty.complete"
    code <<-EOH
    	mkdir /tmp/liberty		
        scp #{node[:common][:scp_repo]}/#{node[:liberty][:downloadfile]} /tmp/liberty && touch "/tmp/downloadliberty.complete"      
    EOH
end

# Install liberty profile
bash "installLibertyProfile" do
  user "root"
  cwd "/tmp/liberty"
	creates "#{node[:liberty][:installDir]}/wlp"
  code <<-EOH
  	#{node[:java7][:installDir]}/bin/java -jar /tmp/liberty/#{node[:liberty][:installerjar]} -acceptLicense #{node[:liberty][:installDir]}
  EOH
end



